//ajax读取部门和员工js函数
/**************************************ajax查询 部门、员工组合使用 显示为下来列表组件  开始***************************************/
/**
	功能说明: 初始化页面组件
	参数说明: objStr: 查询组件放到的容器ID字符串 
	         config{
				deptStr:"deptStr" //部门输入框ID名称 默认deptStr
				deptStrW:'70px' //部门输入框的宽度 默认70px
				deptHiddenId:"deptHiddenId" //部门ID隐藏域ID名称 默认deptHiddenId
				workerStr:"workerStr" //员工输入框ID名称 默认workerStr
				workerStrW:'70px' //员工输入框宽度 默认70px
				workerHiddenId:"workerHiddenId"  //员工ID隐藏域ID名称 默认workerHiddenId
				showId:"showId" //点击显示员工组件ID名称 默认showId 
				showLeft:'100px' //员工下拉箭头距离left的距离 默认100px
				showTop:'100px'  //员工下拉箭头距离top的距离 默认100px
		      }
*/
function deptWorkerInit2(objStr,configPar){
		 /*********参数********/
		this.obj=objStr;
		configPar=configPar || {};
		var defaults = {deptStr:"deptStr",deptStrW:'100px',deptHiddenId:"deptHiddenId",workerStr:"workerStr",workerStrW:'100px',workerHiddenId:"workerHiddenId",showId:"showId",showLeft:'100px',showTop:'100px'};
		this.config = $.extend(defaults,configPar);
        var optionsConfig=this.config;
		/**********初始化页面组件**********/		
		var moduleHTML=[];
		moduleHTML.push('<input type="text" name="'+this.config.deptStr+'" id="'+this.config.deptStr+'" style="width:'+this.config.deptStrW+'" title="输入部门名称(汉字或拼音首字母)" autocomplete="off"/>'); 
        moduleHTML.push('<input type="hidden" name="'+this.config.deptHiddenId+'" id="'+this.config.deptHiddenId+'"/>');
        moduleHTML.push('<input type="text" name="'+this.config.workerStr+'" id="'+this.config.workerStr+'" style="width:'+this.config.workerStrW+'" title="输入员工姓名(汉字或拼音首字母)" autocomplete="off" onfocus="showDWResult(\'results_'+this.config.workerStr+'\')"/>');            
        moduleHTML.push('<input type="hidden" name="'+this.config.workerHiddenId+'" id="'+this.config.workerHiddenId+'"/>');
	  // moduleHTML.push('<span style="position:absolute;cursor:pointer;top:'+this.config.showTop+';left:'+this.config.showLeft+';" id="'+this.config.showId+'" onclick="showDWResult(\'results_'+this.config.workerStr+'\')"><img src="/images/icon/xialajiantou.gif" title="点击显示员工"/></span>');
	   $("#"+this.obj).html(moduleHTML.join(''));
	   moduleHTML=null;
	   //绑定事件
	   bindEvent2(optionsConfig);
}	




function deptWorkerInit(objStr,configPar){
		 /*********参数********/
		this.obj=objStr;
		configPar=configPar || {};
		var defaults = {deptStr:"deptStr",deptStrW:'100px',deptHiddenId:"deptHiddenId",workerStr:"workerStr",workerStrW:'100px',workerHiddenId:"workerHiddenId",showId:"showId",showLeft:'100px',showTop:'100px'};
		this.config = $.extend(defaults,configPar);
        var optionsConfig=this.config;
		/**********初始化页面组件**********/		
		var moduleHTML=[];
		moduleHTML.push('<input type="text" name="'+this.config.deptStr+'" id="'+this.config.deptStr+'" style="width:'+this.config.deptStrW+'" title="输入部门名称(汉字或拼音首字母)" autocomplete="off"/>'); 
        moduleHTML.push('<input type="hidden" name="'+this.config.deptHiddenId+'" id="'+this.config.deptHiddenId+'"/>');
        moduleHTML.push('<input type="text" name="'+this.config.workerStr+'" id="'+this.config.workerStr+'" style="width:'+this.config.workerStrW+'" title="输入员工姓名(汉字或拼音首字母)" autocomplete="off" onfocus="showDWResult(\'results_'+this.config.workerStr+'\')"/>');            
        moduleHTML.push('<input type="hidden" name="'+this.config.workerHiddenId+'" id="'+this.config.workerHiddenId+'"/>');
	  // moduleHTML.push('<span style="position:absolute;cursor:pointer;top:'+this.config.showTop+';left:'+this.config.showLeft+';" id="'+this.config.showId+'" onclick="showDWResult(\'results_'+this.config.workerStr+'\')"><img src="/images/icon/xialajiantou.gif" title="点击显示员工"/></span>');
	   $("#"+this.obj).html(moduleHTML.join(''));
	   moduleHTML=null;
	   //绑定事件
	   bindEvent(optionsConfig);
}	


/**
   功能说明:Ajax部门查询
 */
function searchDept(config){	
	 var deptSearchStr=$("#"+config.deptStr).val();
	 if(typeof(deptSearchStr)=='undefined' || $.trim(deptSearchStr).length<=0){
		 $("#"+config.deptHiddenId).val('');
		 hideDWResult('results_'+config.deptStr);
		 return;
	 }
	 //ajax
	  $.ajax({
		      type:'POST',
			  dataType:'json',
			  url:_rootPath+'/v/deptworker/ajaxgetdept',
			  data:{deptStr:$.trim(deptSearchStr)},
			  success:function(msg){
					var data=msg;	
					var contentHTML=[];
					var le=0;
					if(data.infoNo==1){			
						var jsonArr=eval(data.deptArr) || [];
						le=jsonArr.length;
						if(le<=10){
							contentHTML.push('<ul style="font-family:\'宋体\',Arial;margin:0;padding:0;text-indent:0;width:100%;">');
							contentHTML.push('<li style="background-color:#FFD700;text-indent:3px;line-height:2;color:#3c3c64;width:100%;">');
							contentHTML.push('<span style="float:right;cursor:pointer;" onclick="hideDWResult(\'results_'+config.deptStr+'\');">[关闭]</span>部门列表</li>');
						}else{
							contentHTML.push('<ul style="font-family:\'宋体\',Arial;margin:0;padding:0;text-indent:0;width:100%;">');
							contentHTML.push('<li style="background-color:#FFD700;text-indent:3px;line-height:2;color:#3c3c64;width:188px;">');
							contentHTML.push('<span style="float:right;cursor:pointer;" onclick="hideDWResult(\'results_'+config.deptStr+'\');">[关闭]</span>部门列表</li>');	
						}
						for(var i=0;i<le;i++){	
						   if(i%2==0){
							contentHTML.push("<li style='width:100%;background-color:#FFF;color:#3c3c64;text-indent:3px;line-height:2;cursor:pointer;' onclick='setDeptInfo(\""+config.workerStr+"\",\""+config.workerHiddenId+"\",\""+jsonArr[i].deptName+"\",\""+config.deptStr+"\",\""+jsonArr[i].deptId+"\",\""+config.deptHiddenId+"\")'>");			
							}
							else{
								contentHTML.push("<li style='width:100%;background-color:#F0F1F7;color:#3c3c64;text-indent:3px;line-height:2;cursor:pointer;' onclick='setDeptInfo(\""+config.workerStr+"\",\""+config.workerHiddenId+"\",\""+jsonArr[i].deptName+"\",\""+config.deptStr+"\",\""+jsonArr[i].deptId+"\",\""+config.deptHiddenId+"\")'>");			
							}
							contentHTML.push(jsonArr[i].deptName+"</li>");
						 }
					}
					else{						
						contentHTML.push('<li style="width:100%;background-color:#FFF;text-indent:3px;line-height:2;color:#3c3c64;text-align:center;"><无匹配数据></li>');
								
					}
					contentHTML.push('</ul>');
					var h = (le+1)*24;
					contentHTML.push('<iframe frameborder="0" style="position:absolute;top:0px;left:0px; width:18px; height:'+h+'px; z-index:-1; background:#DFFEBA;filter=\'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)\'" scrolling="no"  ></iframe>');
					$("#results_"+config.deptStr).html(contentHTML.join(''));
					contentHTML="";
					if(le<10){
						$("#results_"+config.deptStr).css("height","auto");
						$("#results_"+config.deptStr).css("overflow-y","hidden");
					}else{
						$("#results_"+config.deptStr).css("height","266px");
						$("#results_"+config.deptStr).css("overflow-y","auto");			
					}
				 //显示
				 showDWResult("results_"+config.deptStr);				
			 }
	  });	
}

/**
	功能说明: ajax查询员工
*/
function searchWorker(config,flg){
	 var workerSearchStr=$("#"+config.workerStr).val();//输入的员工信息
	 var deptId=$("#"+config.deptHiddenId).val();//部门ID
	 if((typeof(workerSearchStr)=='undefined' || $.trim(workerSearchStr).length<=0) && (typeof(deptId)=='undefined' || ""==deptId || isNaN(deptId) || parseInt(deptId)<=0)){
		$("#"+config.workerHiddenId).val('');
		hideDWResult('results_'+config.workerStr);
		return;
	 }
	 //如果没有显示域则创建 主要解决是选择部门后还没创建员工的显示域
	 if($("#results_"+config.workerStr).length<=0){
		    var rLeft=$("#"+config.workerStr).offset().left;//设置层的left为指定组件的left距离
			//var rTop=$("#"+config.workerStr).offset().top+$("#"+config.workerStr).height()+5;//设置层的top距离

			$("#"+config.workerStr).after('<div id="results_'+config.workerStr+'" style="border:1px solid #000000; overflow-x:hidden;width:270px;height:auto;background:#FCFCFC;position:absolute;left:'+rLeft+'px;margin-top:0;*margin-top:22px;z-index:9999;font-size:12px;display:none;"></div>'); 
	  }
	 //ajax
	  $.ajax({
		      type:'POST',
			  dataType:'json',             
			  url:_rootPath+'/v/deptworker/ajaxgetworkershang',//修改方法
			  data:{workerStr:$.trim(workerSearchStr),workerDeptId:deptId},
			  success:function(msg){
					var data=msg;	
					var contentHTML=[];
					var le=0;
					if(data.infoNo==1){			
						var jsonArr=eval(data.workerArr) || [];
						le=jsonArr.length;
						if(le<=10){
							contentHTML.push('<ul style="font-family:\'宋体\',Arial;margin:0;padding:0;text-indent:0;width:100%;">');
							contentHTML.push('<li style="width:100%;background-color:#FFD700;text-indent:3px;line-height:2;color:#3c3c64;">');
							contentHTML.push('<span style="float:right;cursor:pointer;" onclick="hideDWResult(\'results_'+config.workerStr+'\');">[关闭]</span>员工列表</li>');
						}else{
							contentHTML.push('<ul style="font-family:\'宋体\',Arial;margin:0;padding:0;text-indent:0;width:100%;">');
							contentHTML.push('<li style="width:100%;background-color:#FFD700;text-indent:3px;line-height:2;color:#3c3c64;">');
							contentHTML.push('<span style="float:right;cursor:pointer;" onclick="hideDWResult(\'results_'+config.workerStr+'\');">[关闭]</span>员工列表</li>');
						}
						for(var i=0;i<le;i++){	
						   if(i%2==0){
							contentHTML.push("<li style='width:100%;background-color:#FFF;color:#3c3c64;text-indent:3px;line-height:2;cursor:pointer;' onclick='setWorkerInfo(\""+jsonArr[i].workerName+"\",\""+config.workerStr+"\",\""+jsonArr[i].id+"\",\""+config.workerHiddenId+"\",\""+jsonArr[i].deptName+"\",\""+config.deptStr+"\",\""+jsonArr[i].deptId+"\",\""+config.deptHiddenId+"\")'>");			
							}
							else{
								contentHTML.push("<li style='width:100%;background-color:#F0F1F7;color:#3c3c64;text-indent:3px;line-height:2;cursor:pointer;' onclick='setWorkerInfo(\""+jsonArr[i].workerName+"\",\""+config.workerStr+"\",\""+jsonArr[i].id+"\",\""+config.workerHiddenId+"\",\""+jsonArr[i].deptName+"\",\""+config.deptStr+"\",\""+jsonArr[i].deptId+"\",\""+config.deptHiddenId+"\")''>");			
							}
							contentHTML.push(jsonArr[i].deptName+"&nbsp;&nbsp;<strong>"+jsonArr[i].workerName+"</strong></li>");
						 }
					}
					else{						
						contentHTML.push('<li style="width:100%;background-color:#FFF;text-indent:3px;line-height:2;color:#3c3c64;text-align:center;"><无匹配数据></li>');
								
					}
					contentHTML.push('</ul>');
					var h = (le+1)*24;
					contentHTML.push('<iframe frameborder="0" style="position:absolute;top:0px;left:0px; width:200px; height:'+h+'px; z-index:-1; background:#DFFEBA;filter=\'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)\'" scrolling="no"></iframe>');
					$("#results_"+config.workerStr).html(contentHTML.join(''));
					contentHTML="";
					if(le<10){
						$("#results_"+config.workerStr).css("height","auto");
						$("#results_"+config.workerStr).css("overflow-y","hidden");
					}else{
						$("#results_"+config.workerStr).css("height","266px");
						$("#results_"+config.workerStr).css("overflow-y","auto");			
					}
				  //显示结果域
				  if(flg)
				     showDWResult("results_"+config.workerStr);
			 }
	  });	
}

function bindEvent2(config){
	//部门输入框事件
	$("#"+config.deptStr).bind("keyup",function(evt){	
			if($("#results_"+config.deptStr).length<=0){
				var rLeft=$(this).offset().left;//设置层的left为指定组件的left距离
				//var rTop=$(this).offset().top+$(this).height()+5;//设置层的top距离

			   $(this).after('<div id="results_'+config.deptStr+'" style="border:1px solid #000000; overflow-x:hidden;width:200px;height:auto;background:#FCFCFC;position:absolute;left:'+rLeft+'px;margin-top:0;*margin-top:22px;z-index:9999;font-size:12px;display:none;padding-left:0;"></div>');
		    }
			$("#results_"+config.deptStr).html("");
			searchDept(config);//ajax查询			
      });
   //员工输入框事件
  	$("#"+config.workerStr).bind("keyup",function(event){
			var key=event.keyCode;
			if(key==8){
				$("#"+config.deptStr).val('');
				$("#"+config.deptHiddenId).val('');
			}
			if($("#results_"+config.workerStr).length<=0){
				var rLeft=$(this).offset().left;//设置层的left为指定组件的left距离
				//var rTop=$(this).offset().top+$(this).height()+5;//设置层的top距离
			   $(this).after('<div id="results_'+config.workerStr+'" style="border:1px solid #000000; overflow-x:hidden;width:230px;height:auto;background:#FCFCFC;position:absolute;left:'+rLeft+'px;margin-top:0;*margin-top:22px;z-index:9999;font-size:12px;display:none;padding-left:0;"></div>');
			}
			$("#results_"+config.workerStr).html("");
			getManager(config,true);//ajax查询				
      });
		$("#"+config.workerStr).bind("click",function(){
			$("#results_"+config.deptStr).hide()
		 });
}
/**
   功能说明: 绑定输入框事件
*/
function bindEvent(config){
	//部门输入框事件
	$("#"+config.deptStr).bind("keyup",function(evt){	
			if($("#results_"+config.deptStr).length<=0){
				var rLeft=$(this).offset().left;//设置层的left为指定组件的left距离
				//var rTop=$(this).offset().top+$(this).height()+5;//设置层的top距离

			   $(this).after('<div id="results_'+config.deptStr+'" style="border:1px solid #000000; overflow-x:hidden;width:200px;height:auto;background:#FCFCFC;position:absolute;left:'+rLeft+'px;margin-top:0;*margin-top:22px;z-index:9999;font-size:12px;display:none;padding-left:0;"></div>');
		    }
			$("#results_"+config.deptStr).html("");
			searchDept(config);//ajax查询			
      });
   //员工输入框事件
  	$("#"+config.workerStr).bind("keyup",function(event){
			var key=event.keyCode;
			if(key==8){
				$("#"+config.deptStr).val('');
				$("#"+config.deptHiddenId).val('');
			}
			if($("#results_"+config.workerStr).length<=0){
				var rLeft=$(this).offset().left;//设置层的left为指定组件的left距离
				//var rTop=$(this).offset().top+$(this).height()+5;//设置层的top距离
			   $(this).after('<div id="results_'+config.workerStr+'" style="border:1px solid #000000; overflow-x:hidden;width:230px;height:auto;background:#FCFCFC;position:absolute;left:'+rLeft+'px;margin-top:0;*margin-top:22px;z-index:9999;font-size:12px;display:none;padding-left:0;"></div>');
			}
			$("#results_"+config.workerStr).html("");
			//getManager(config,true);//ajax查询				
			searchWorker(config,true);//ajax查询				
      });
  	 $("#"+config.workerStr).bind("click",function(){
		$("#results_"+config.deptStr).hide()
	 });
}
/**
	功能说明:设置员工信息
	参数说明: workerName //员工姓名值
	         configWorkerName //员工输入框组件ID字符串
			 workerId //员工记录ID值
			 configWorkerId //员工ID隐藏域组件ID字符串
			 deptName //部门名称值
			 configDeptName //部门输入框组件ID字符串
			 deptId //部门ID值
			 configDeptId //部门隐藏域自己ID字符串
	 
*/
function setWorkerInfo(workerName,configWorkerName,workerId,configWorkerId,deptName,configDeptName,deptId,configDeptId){
	//alert(":workerName="+workerName+":workerId="+workerId+":deptName="+deptName+":deptId="+deptId);
	//alert("configWorkerName="+configWorkerName+"configWorkerId="+configWorkerId);
	$("#"+configWorkerName).val(workerName);
	if(configWorkerId==null || configWorkerId == undefined || configWorkerId == 'undefined'){
		$("#"+configWorkerName).parent().children().eq(4).val(workerId);//用户编号
		$("#"+configWorkerName).parent().children().eq(1).val(deptId);//部门编号
	}else{
		$("#"+configWorkerId).val(workerId);
		$("#"+configDeptId).val(deptId);
	}
	$("#"+configDeptName).val(deptName);
	hideDWResult("results_"+configWorkerName);
}
/**
	功能说明: 设置部门信息
	参数说明: configWorkerName //员工输入框组件ID字符串
	         configWorkerId //员工隐藏域组件ID字符串
			 deptName //部门名称值
			 configDeptName //部门输入框组件ID字符串
			 deptId //部门ID值
			 configDeptId //部门隐藏域组件ID字符串
*/
function setDeptInfo(configWorkerName,configWorkerId,deptName,configDeptName,deptId,configDeptId){
	//alert(":deptName="+deptName+":deptId="+deptId);
	var config={deptStr:configDeptName,deptHiddenId:configDeptId,workerStr:configWorkerName,workerHiddenId:configWorkerId};
	$("#"+configWorkerName).val("");
	$("#"+configWorkerId).val("");
	$("#"+configDeptName).val(deptName);
	$("#"+configDeptId).val(deptId);
	hideDWResult("results_"+configDeptName);
	searchWorker(config,false);//ajax查询员工
}
/**************************************ajax查询 部门、员工组合使用 显示为下来列表组件  结束***************************************/
/****************************************可独立ajax查询 部门、员工 显示为下来列表   开始*****************************************/

/**
   功能说明:Ajax部门查询
   参数说明:config 为{deptStr:'',deptHiddenId:'',handleFun:''}的json格式            
		   deptStr为输入框ID字符串
		   deptHiddenId为存放部门ID信息隐藏域ID字符串
		   handleFun:需要进一步处理的自定义函数 参数为部门json格式信息{deptId:'',deptName:''},如需要关闭请调用  hideDWResult('results_输入框ID字符串');
   调用示例:onkeyup="ajaxGetDept({deptStr:'parentDeptName',deptHiddenId:'parentDeptNumber',handleFun:'setDeptInfo'})"
*/
function ajaxGetDept(config){	
	 var deptSearchStr=$("#"+config.deptStr).val();
	 if(typeof(deptSearchStr)=='undefined' || $.trim(deptSearchStr).length<=0){
		 $("#"+config.deptHiddenId).val('');
		 hideDWResult('results_'+config.deptStr);
		 return;
	 }
	 //创建下拉显示层
	 if($("#results_"+config.deptStr).length<=0){
		 var rLeft=$("#"+config.deptStr).offset().left;//设置层的left为指定组件的left距		
		 $("#"+config.deptStr).after('<div id="results_'+config.deptStr+'" style="border:1px solid #000000; overflow-x:hidden;width:200px;height:auto;;background:#FCFCFC;position:absolute;left:'+rLeft+'px;margin-top:0;*margin-top:22px;z-index:9999;font-size:12px;display:none;padding-left:0;"></div>');
	}
	$("#results_"+config.deptStr).html("");
	 //ajax
	  $.ajax({
		      type:'POST',
			  dataType:'json',
			  url:_rootPath+'/v/deptworker/ajaxgetdept',
			  data:{deptStr:$.trim(deptSearchStr)},
			  success:function(msg){
					var data=msg;	
					var contentHTML=[];
					contentHTML.push('<ul style="font-family:\'宋体\',Arial;margin:0;padding:0;text-indent:0;width:100%;">');
					contentHTML.push('<li style="background-color:#AFD9E6;text-indent:3px;line-height:2;color:#3c3c64;width:100%;">');
					contentHTML.push('<span style="float:right;margin-right:20px;cursor:pointer;" onclick="hideDWResult(\'results_'+config.deptStr+'\');">[关闭]</span>部门列表</li>');
					var le=0;
					if(data.infoNo==1){			
						var jsonArr=eval(data.deptArr) || [];
						le=jsonArr.length;
						for(var i=0;i<le;i++){							 						 
						   if(i%2==0){
							contentHTML.push("<li style='background-color:#FFF;color:#3c3c64;text-indent:3px;line-height:2;cursor:pointer;width:100%;' onclick='"+config.handleFun+"("+ doJSONObjToStr(jsonArr[i])+")'>");			
							}
							else{
								contentHTML.push("<li style='background-color:#F0F1F7;color:#3c3c64;text-indent:3px;line-height:2;cursor:pointer;width:100%;' onclick='"+config.handleFun+"("+ doJSONObjToStr(jsonArr[i])+")'>");			
							}
							contentHTML.push(jsonArr[i].deptName+"</li>");
						 }
					}
					else{						
						contentHTML.push('<li style="background-color:#FFF;text-indent:3px;line-height:2;color:#3c3c64;text-align:center;width:100%;"><无匹配数据></li>');
								
					}
					contentHTML.push('</ul>');
					contentHTML.push('<iframe frameborder="0" style="position:absolute;top:0px;left:0px; width:180px; height:1000px; z-index:-1; background:#DFFEBA;filter=\'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)\'" scrolling="no"  ></iframe>');
					$("#results_"+config.deptStr).html(contentHTML.join(''));
					contentHTML="";
					if(le<10){
						$("#results_"+config.deptStr).css("height","auto");
						$("#results_"+config.deptStr).css("overflow-y","hidden");
					}else{
						$("#results_"+config.deptStr).css("height","266px");
						$("#results_"+config.deptStr).css("overflow-y","auto");			
					}
				 //显示
				 showDWResult("results_"+config.deptStr);				
			 }
	  });	
}



function getWokerByShop(config){
	var workerSearchStr=$("#"+config.workerStr).val();//输入的员工信息
	var shopid=$("#"+config.shopid).val();//输入的员工信息	
	 if((typeof(workerSearchStr)=='undefined' || $.trim(workerSearchStr).length<=0)){
		$("#"+config.workerHiddenId).val('');
		hideDWResult('results_'+config.workerStr);
		return;
	 }
	 //如果没有显示域则创建 主要解决是选择部门后还没创建员工的显示域
	 if($("#results_"+config.workerStr).length<=0){
		    var rLeft=0;
			if('undefined' == typeof(config.rleft) ){
				rLeft=$("#"+config.workerStr).offset().left;//设置层的left为指定组件的left距离 
			}else{
				rLeft =config.rleft;
				
			}
			$("#"+config.workerStr).after('<div id="results_'+config.workerStr+'" style="border:1px solid #000000; overflow-x:hidden;width:230px;height:auto;background:#FCFCFC;position:absolute;left:'+rLeft+'px;margin-top:0;*margin-top:22px;z-index:9999;font-size:12px;display:none;"></div>'); 
	  }
	 //ajax
	  $.ajax({
		      type:'POST',
			  dataType:'json',
			  url:_rootPath+'/v/deptworker/ajaxWorkByShop',
			  data:{workerStr:$.trim(workerSearchStr),shopStr:$.trim(shopid)},
			  success:function(msg){
					var data=msg;	
					var contentHTML=[];
					var le=0;
					
					if(data.infoNo==1){			
						var jsonArr=eval(data.workerArr) || [];
						le=jsonArr.length;
						var h=(le+1)*24;
						contentHTML.push('<ul style="font-family:\'宋体\',Arial;margin:0;padding:0;text-indent:0;width:100%;height:'+h+'px">');
						contentHTML.push('<li style="background-color:#AFD9E6;text-indent:3px;line-height:2;color:#3c3c64;width:230px;text-align:left;float:left">');
						contentHTML.push('<span style="float:right;margin-right:20px;cursor:pointer;" onclick="hideDWResult(\'results_'+config.workerStr+'\');">[关闭]</span>员工列表</li>');
						for(var i=0;i<le;i++){	
						   if(i%2==0){
							contentHTML.push("<li style='background-color:#FFF;color:#3c3c64;text-indent:3px;line-height:2;cursor:pointer;width:230px;' onclick='"+config.handleFun+"("+ doJSONObjToStr(jsonArr[i])+")'>");			
							}
							else{
								contentHTML.push("<li style='background-color:#F0F1F7;color:#3c3c64;text-indent:3px;line-height:2;cursor:pointer;width:230px;' onclick='"+config.handleFun+"("+ doJSONObjToStr(jsonArr[i])+")'>");			
							}
							contentHTML.push("<span style='text-align:left;float:left;width:140px;'>"+jsonArr[i].deptName+"</span><strong style='text-align:left;float:left'>"+jsonArr[i].workerName+"</strong></li>");
						 }
					}
					else{						
						contentHTML.push('<li style="background-color:#FFF;text-indent:3px;line-height:2;color:#3c3c64;text-align:center;width:230px;"><只能选择本分行人员></li>');
								
					}
					contentHTML.push('</ul>');
					contentHTML.push('<iframe frameborder="0" style="position:absolute;top:0px;left:0px; width:200px; height:'+h+'px; z-index:-1; background:#FFFFFF;filter=\'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)\'" scrolling="no"></iframe>');
					$("#results_"+config.workerStr).html(contentHTML.join(''));
					contentHTML="";
					if(le<10){
						$("#results_"+config.workerStr).css("height","auto");
						$("#results_"+config.workerStr).css("overflow-y","hidden");
					}else{
						$("#results_"+config.workerStr).css("height","266px");
						$("#results_"+config.workerStr).css("overflow-y","auto");			
					}
				  //显示结果域
				  showDWResult("results_"+config.workerStr);
			 }
	  });		
}


/**
	店铺查询
*/
function ajaxGetShop(config){
	var workerSearchStr = $("#" + config.workerStr).val();// 输入的员工信息
	if ((typeof (workerSearchStr) == 'undefined' || $.trim(workerSearchStr).length <= 0)) {
		$("#" + config.workerHiddenId).val('');
		hideDWResult('results_' + config.workerStr);
		return;
	}
	 //如果没有显示域则创建 主要解决是选择部门后还没创建员工的显示域
	if($("#results_"+config.workerStr).length<=0){
		    var rLeft=0;
			if('undefined' == typeof(config.rleft) ){
				rLeft=$("#"+config.workerStr).offset().left;//设置层的left为指定组件的left距离 
			}else{
				rLeft =config.rleft;
				
			}
			$("#"+config.workerStr).after('<div id="results_'+config.workerStr+'" style="border:1px solid #000000; overflow-x:hidden;width:150px;height:auto;background:#FCFCFC;position:absolute;left:'+rLeft+'px;margin-top:0;*margin-top:22px;z-index:9999;font-size:12px;display:none;"></div>'); 
	}

	  $.ajax({
		      type:'POST',
			  dataType:'json',
			  url:_rootPath+'/v/deptworker/ajaxShop',
			  data:{idStr:$.trim(workerSearchStr)},
			  success:function(msg){
					var data=msg;	
					var contentHTML=[];
					var le=0;
					
					if(data.infoNo==1){			
						var jsonArr=eval(data.postList) || [];
						le=jsonArr.length;
						var h=(le+1)*24;
						contentHTML.push('<ul style="font-family:\'宋体\',Arial;margin:0;padding:0;text-indent:0;width:100%;height:'+h+'px">');
						contentHTML.push('<li style="background-color:#AFD9E6;text-indent:3px;line-height:2;color:#3c3c64;width:150px;text-align:left;float:left">');
						contentHTML.push('<span style="float:right;margin-right:20px;cursor:pointer;" onclick="hideDWResult(\'results_'+config.workerStr+'\');">[关闭]</span>分行列表</li>');
						for(var i=0;i<le;i++){	
						   if(i%2==0){
								contentHTML.push("<li style='background-color:#FFF;color:#3c3c64;text-indent:3px;line-height:2;cursor:pointer;width:150px;' onclick='"+config.handleFun+"("+ doJSONObjToStr(jsonArr[i])+")'>");			
							}
							else{
								contentHTML.push("<li style='background-color:#F0F1F7;color:#3c3c64;text-indent:3px;line-height:2;cursor:pointer;width:150px;' onclick='"+config.handleFun+"("+ doJSONObjToStr(jsonArr[i])+")'>");			
							}
							contentHTML.push("<span style='text-align:left;float:left;width:150px;'>"+jsonArr[i].name+"</span></li>");
						 }
					}
					else{	
						contentHTML.push('<ul style="font-family:\'宋体\',Arial;margin:0;padding:0;text-indent:0;width:100%;height:24px">');
						contentHTML.push('<li style="background-color:#AFD9E6;text-indent:3px;line-height:2;color:#3c3c64;width:150px;text-align:left;float:left">');
						contentHTML.push('<span style="float:right;margin-right:20px;cursor:pointer;" onclick="hideDWResult(\'results_'+config.workerStr+'\');">[关闭]</span>分行列表</li>');
						contentHTML.push('<li style="background-color:#FFF;text-indent:3px;line-height:2;color:#3c3c64;text-align:center;width:150px;"><无匹配数据></li>');
								
					}
					contentHTML.push('</ul>');
					contentHTML.push('<iframe frameborder="0" style="position:absolute;top:0px;left:0px; width:200px; height:'+h+'px; z-index:-1; background:#FFFFFF;filter=\'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)\'" scrolling="no"></iframe>');
					$("#results_"+config.workerStr).html(contentHTML.join(''));
					contentHTML="";
					if(le<10){
						$("#results_"+config.workerStr).css("height","auto");
						$("#results_"+config.workerStr).css("overflow-y","hidden");
					}else{
						$("#results_"+config.workerStr).css("height","266px");
						$("#results_"+config.workerStr).css("overflow-y","auto");			
					}
				  //显示结果域
				  showDWResult("results_"+config.workerStr);
			 }
	  });	



}



/**
	功能说明:Ajax查询管理层员工 登录
	参数说明:config 为{workerStr:'',workerHiddenId:'',handleFun:''}的json格式            
		   workerStr为输入框ID字符串
		   workerHiddenId为存放员工ID信息隐藏域ID字符串
		   handleFun:需要进一步处理的自定义函数,自动传递参数 参数为员工json格式信息{workerName:"",workerId:"",deptId:"",deptName:''},如需要关闭请调用  hideDWResult('results_输入框ID字符串');
   调用示例:onkeyup="ajaxGetWorker({workerStr:'workerName',workerHiddenId:'workerId',handleFun:"setWorkerInfo"})"
*/
function getManager(config,flg){
	var workerSearchStr=$("#"+config.workerStr).val();//输入的员工信息
	 var deptId=$("#"+config.deptHiddenId).val();//部门ID
	 if((typeof(workerSearchStr)=='undefined' || $.trim(workerSearchStr).length<=0) && (typeof(deptId)=='undefined' || ""==deptId || isNaN(deptId) || parseInt(deptId)<=0)){
		$("#"+config.workerHiddenId).val('');
		hideDWResult('results_'+config.workerStr);
		return;
	 }
	 //如果没有显示域则创建 主要解决是选择部门后还没创建员工的显示域
	 if($("#results_"+config.workerStr).length<=0){
		    var rLeft=$("#"+config.workerStr).offset().left;//设置层的left为指定组件的left距离
			//var rTop=$("#"+config.workerStr).offset().top+$("#"+config.workerStr).height()+5;//设置层的top距离

			$("#"+config.workerStr).after('<div id="results_'+config.workerStr+'" style="border:1px solid #000000; overflow-x:hidden;width:230px;height:auto;background:#FCFCFC;position:absolute;left:'+rLeft+'px;margin-top:0;*margin-top:22px;z-index:9999;font-size:12px;display:none;"></div>'); 
	  }
	 //ajax
	  $.ajax({
		      type:'POST',
			  dataType:'json',             
			  url:_rootPath+'/v/deptworker/ajaxGetManager',//修改方法
			  data:{workerStr:$.trim(workerSearchStr),workerDeptId:deptId},
			  success:function(msg){
					var data=msg;	
					var contentHTML=[];
					var le=0;
					if(data.infoNo==1){			
						var jsonArr=eval(data.workerArr) || [];
						le=jsonArr.length;
						if(le<=10){
							contentHTML.push('<ul style="font-family:\'宋体\',Arial;margin:0;padding:0;text-indent:0;width:100%;">');
							contentHTML.push('<li style="width:100%;background-color:#FFD700;text-indent:3px;line-height:2;color:#3c3c64;">');
							contentHTML.push('<span style="float:right;cursor:pointer;" onclick="hideDWResult(\'results_'+config.workerStr+'\');">[关闭]</span>员工列表</li>');
						}else{
							contentHTML.push('<ul style="font-family:\'宋体\',Arial;margin:0;padding:0;text-indent:0;width:100%;">');
							contentHTML.push('<li style="width:212px;background-color:#FFD700;text-indent:3px;line-height:2;color:#3c3c64;">');
							contentHTML.push('<span style="float:right;cursor:pointer;" onclick="hideDWResult(\'results_'+config.workerStr+'\');">[关闭]</span>员工列表</li>');
						}
						for(var i=0;i<le;i++){	
						   if(i%2==0){
							contentHTML.push("<li style='width:100%;background-color:#FFF;color:#3c3c64;text-indent:3px;line-height:2;cursor:pointer;' onclick='setWorkerInfo(\""+jsonArr[i].workerName+"\",\""+config.workerStr+"\",\""+jsonArr[i].id+"\",\""+config.workerHiddenId+"\",\""+jsonArr[i].deptName+"\",\""+config.deptStr+"\",\""+jsonArr[i].deptId+"\",\""+config.deptHiddenId+"\")'>");			
							}
							else{
								contentHTML.push("<li style='width:100%;background-color:#F0F1F7;color:#3c3c64;text-indent:3px;line-height:2;cursor:pointer;' onclick='setWorkerInfo(\""+jsonArr[i].workerName+"\",\""+config.workerStr+"\",\""+jsonArr[i].id+"\",\""+config.workerHiddenId+"\",\""+jsonArr[i].deptName+"\",\""+config.deptStr+"\",\""+jsonArr[i].deptId+"\",\""+config.deptHiddenId+"\")''>");			
							}
							contentHTML.push(jsonArr[i].deptName+"&nbsp;&nbsp;<strong>"+jsonArr[i].workerName+"</strong></li>");
						 }
					}
					else{						
						contentHTML.push('<li style="width:100%;background-color:#FFF;text-indent:3px;line-height:2;color:#3c3c64;text-align:center;"><无匹配数据></li>');
								
					}
					contentHTML.push('</ul>');
					var h = (le+1)*24;
					contentHTML.push('<iframe frameborder="0" style="position:absolute;top:0px;left:0px; width:200px; height:'+h+'px; z-index:-1; background:#DFFEBA;filter=\'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)\'" scrolling="no"></iframe>');
					$("#results_"+config.workerStr).html(contentHTML.join(''));
					contentHTML="";
					if(le<10){
						$("#results_"+config.workerStr).css("height","auto");
						$("#results_"+config.workerStr).css("overflow-y","hidden");
					}else{
						$("#results_"+config.workerStr).css("height","266px");
						$("#results_"+config.workerStr).css("overflow-y","auto");			
					}
				  //显示结果域
				  if(flg)
				     showDWResult("results_"+config.workerStr);
			 }
	  });	
}

/**
	功能说明:Ajax查询员工
	参数说明:config 为{workerStr:'',workerHiddenId:'',handleFun:''}的json格式            
		   workerStr为输入框ID字符串
		   workerHiddenId为存放员工ID信息隐藏域ID字符串
		   handleFun:需要进一步处理的自定义函数,自动传递参数 参数为员工json格式信息{workerName:"",workerId:"",deptId:"",deptName:''},如需要关闭请调用  hideDWResult('results_输入框ID字符串');
   调用示例:onkeyup="ajaxGetWorker({workerStr:'workerName',workerHiddenId:'workerId',handleFun:"setWorkerInfo"})"
*/
function ajaxGetWorker(config){
	var workerSearchStr=$("#"+config.workerStr).val();//输入的员工信息	
	$("#"+config.workerHiddenId).val('');
	if((typeof(workerSearchStr)=='undefined' || $.trim(workerSearchStr).length<=0)){
		hideDWResult('results_'+config.workerStr);
		return;
	}
	//如果没有显示域则创建 主要解决是选择部门后还没创建员工的显示域
	if($("#results_"+config.workerStr).length<=0){
		var rLeft=0;
		if('undefined' == typeof(config.rleft) ){
			rLeft=$("#"+config.workerStr).offset().left;//设置层的left为指定组件的left距离 
		}else{
			rLeft =config.rleft;
			
		}
		$("#"+config.workerStr).after('<div id="results_'+config.workerStr+'" style="border:1px solid #000000; overflow-x:hidden;width:270px;height:auto;background:#FCFCFC;position:absolute;left:'+rLeft+'px;margin-top:0;*margin-top:22px;z-index:9999;font-size:12px;display:none;"></div>'); 
	}
	//ajax
	$.ajax({
		type:'POST',
		dataType:'json',
		url:_rootPath+'/v/deptworker/ajaxgetworker',
		data:{workerStr:$.trim(workerSearchStr)},
		success:function(msg){
			var data=msg;	
			var contentHTML=[];
			var le=0;
			
			if(data.infoNo==1){			
				var jsonArr=eval(data.workerArr) || [];
				le=jsonArr.length;
				var h=(le+1)*26;
				contentHTML.push('<ul style="font-family:\'宋体\',Arial;margin:0;padding:0;text-indent:0;width:100%;height:'+h+'px">');
				contentHTML.push('<li style="background-color:#AFD9E6;text-indent:3px;height:24px;line-height:24px;color:#3c3c64;width:270px;text-align:left;float:left">');
				contentHTML.push('<span style="float:right;margin-right:20px;cursor:pointer;line-height:24px;" onclick="hideDWResult(\'results_'+config.workerStr+'\');">[关闭]</span>员工列表</li>');
				for(var i=0;i<le;i++){	
					if(i%2==0){
						contentHTML.push("<li style='background-color:#FFF;color:#3c3c64;text-indent:3px;line-height:26px;height:26px;cursor:pointer;width:270px;' onclick='"+config.handleFun+"("+ doJSONObjToStr(jsonArr[i])+")'>");			
					}
					else{
						contentHTML.push("<li style='background-color:#F0F1F7;color:#3c3c64;text-indent:3px;line-height:26px;height:26px;cursor:pointer;width:270px;' onclick='"+config.handleFun+"("+ doJSONObjToStr(jsonArr[i])+")'>");			
					}
					contentHTML.push("<span style='text-align:left;float:left;width:140px;line-height:26px;height:26px;'>"+jsonArr[i].deptName+"</span><strong style='text-align:left;float:left'>"+jsonArr[i].workerName+"</strong></li>");
				}
			}
			else{						
				contentHTML.push('<li style="background-color:#FFF;text-indent:3px;line-height:2;color:#3c3c64;text-align:center;width:230px;"><无匹配数据></li>');
				
			}
			contentHTML.push('</ul>');
			contentHTML.push('<iframe frameborder="0" style="position:absolute;top:0px;left:0px; width:200px; height:'+h+'px; z-index:-1; background:#FFFFFF;filter=\'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)\'" scrolling="no"></iframe>');
			$("#results_"+config.workerStr).html(contentHTML.join(''));
			contentHTML="";
			if(le<10){
				$("#results_"+config.workerStr).css("height","auto");
				$("#results_"+config.workerStr).css("overflow-y","hidden");
			}else{
				$("#results_"+config.workerStr).css("height","266px");
				$("#results_"+config.workerStr).css("overflow-y","auto");			
			}
			//显示结果域
			showDWResult("results_"+config.workerStr);
		}
	});	
}

function ajaxGetWorker_when(config){
	 var workerSearchStr=$("#"+config.workerStr).val();//输入的员工信息	
	 $("#"+config.workerHiddenId).val('');
	 if((typeof(workerSearchStr)=='undefined' || $.trim(workerSearchStr).length<=0)){
		hideDWResult('results_'+config.workerStr);
		return;
	 }
	 //如果没有显示域则创建 主要解决是选择部门后还没创建员工的显示域
	 if($("#results_"+config.workerStr).length<=0){
		    var rLeft=0;
			if('undefined' == typeof(config.rleft) ){
				rLeft=$("#"+config.workerStr).offset().left;//设置层的left为指定组件的left距离 
			}else{
				rLeft =config.rleft;
				
			}
			$("#"+config.workerStr).after('<div id="results_'+config.workerStr+'" style="border:1px solid #000000; overflow-x:hidden;width:270px;height:auto;background:#FCFCFC;position:absolute;left:'+rLeft+'px;margin-top:0;*margin-top:22px;z-index:9999;font-size:12px;display:none;"></div>'); 
	  }
	 //ajax
	  $.ajax({
		      type:'POST',
			  dataType:'json',
			  url:_rootPath+'/v/deptworker/ajaxgetworker',
			  data:
			  {
				  	workerStr : $.trim(workerSearchStr),
					searchType : isEmpty(config.searchType) ? '' : config.searchType,
					searchKey : isEmpty(config.searchKey) ? '' : config.searchKey,
					searchTop : 1
			  },
			  success:function(msg){
					var data=msg;	
					var contentHTML=[];
					var le=0;
					
					if(data.infoNo==1){			
						var jsonArr=eval(data.workerArr) || [];
						le=jsonArr.length;
						var h=(le+1)*26;
						contentHTML.push('<ul style="font-family:\'宋体\',Arial;margin:0;padding:0;text-indent:0;width:100%;height:'+h+'px">');
						contentHTML.push('<li style="background-color:#AFD9E6;text-indent:3px;height:24px;line-height:24px;color:#3c3c64;width:270px;text-align:left;float:left">');
						contentHTML.push('<span style="float:right;margin-right:20px;cursor:pointer;line-height:24px;" onclick="hideDWResult(\'results_'+config.workerStr+'\');">[关闭]</span>员工列表</li>');
						for(var i=0;i<le;i++){	
						   if(i%2==0){
							contentHTML.push("<li style='background-color:#FFF;color:#3c3c64;text-indent:3px;line-height:26px;height:26px;cursor:pointer;width:270px;' onclick='"+config.handleFun+"("+ doJSONObjToStr(jsonArr[i])+")'>");			
							}
							else{
								contentHTML.push("<li style='background-color:#F0F1F7;color:#3c3c64;text-indent:3px;line-height:26px;height:26px;cursor:pointer;width:270px;' onclick='"+config.handleFun+"("+ doJSONObjToStr(jsonArr[i])+")'>");			
							}
							contentHTML.push("<span style='text-align:left;float:left;width:140px;line-height:26px;height:26px;'>"+jsonArr[i].deptName+"</span><strong style='text-align:left;float:left'>"+jsonArr[i].workerName+"</strong></li>");
						 }
					}
					else{						
						contentHTML.push('<li style="background-color:#FFF;text-indent:3px;line-height:2;color:#3c3c64;text-align:center;width:230px;"><无匹配数据></li>');
								
					}
					contentHTML.push('</ul>');
					contentHTML.push('<iframe frameborder="0" style="position:absolute;top:0px;left:0px; width:200px; height:'+h+'px; z-index:-1; background:#FFFFFF;filter=\'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)\'" scrolling="no"></iframe>');
					$("#results_"+config.workerStr).html(contentHTML.join(''));
					contentHTML="";
					if(le<10){
						$("#results_"+config.workerStr).css("height","auto");
						$("#results_"+config.workerStr).css("overflow-y","hidden");
					}else{
						$("#results_"+config.workerStr).css("height","266px");
						$("#results_"+config.workerStr).css("overflow-y","auto");			
					}
				  //显示结果域
				  showDWResult("results_"+config.workerStr);
			 }
	  });	
}

/**
 * 新封装--可通过条件过滤，例如searchType：1,查询指定searchKey的直属 2：按职位ID查询 searchKey对应职位的人员，可以是多个职位用逗号分隔97,129--97（副总级） 129（区总级）
 * @param config
 */
function ajaxGetWorker_new(config){
	var id=config.obj.attr("name")+"_"+config.obj.offset().top+"_"+config.obj.parent().parent().index();
	 config.obj.attr("id",id);
	 var workerSearchStr=config.obj.val();//输入的员工信息
	 var hiddenIdObj=config.obj.parent().find("input[type='hidden']");
	 if((typeof(workerSearchStr)=='undefined' || $.trim(workerSearchStr).length<=0)){
		 hideDWResult('results_'+id);
		 return;
	 }
	 //如果没有显示域则创建 主要解决是选择部门后还没创建员工的显示域
	 if($("#results_"+id).length<=0){
		    var rLeft=0;
			if('undefined' == typeof(config.rleft) ){
				rLeft=config.obj.offset().left;//设置层的left为指定组件的left距离 
			}else{
				rLeft =config.rleft;
				
			}
			config.obj.after('<div id="results_'+id+'" style="border:1px solid #000000; overflow-x:hidden;width:230px;height:auto;background:#FCFCFC;position:absolute;left:'+rLeft+'px;margin-top:0;*margin-top:22px;z-index:9999;font-size:12px;display:none;"></div>'); 
	  }
	 //ajax
	  $.ajax({
		      type:'POST',
			  dataType:'json',
			  url:_rootPath+'/v/deptworker/ajaxgetworker',
			  data:
			  {
				  	workerStr : $.trim(workerSearchStr),
					searchType : isEmpty(config.searchType) ? '' : config.searchType,
					searchKey : isEmpty(config.searchKey) ? '' : config.searchKey
			  },
			  success:function(msg){
					var data=msg;	
					var contentHTML=[];
					var le=0;
					
					if(data.infoNo==1){			
						var jsonArr=eval(data.workerArr) || [];
						le=jsonArr.length;
						var h=(le+1)*24;
						contentHTML.push('<ul style="font-family:\'宋体\',Arial;margin:0;padding:0;text-indent:0;width:100%;height:'+h+'px">');
						contentHTML.push('<li style="background-color:#AFD9E6;text-indent:3px;line-height:2;color:#3c3c64;width:230px;text-align:left;float:left">');
						contentHTML.push('<span style="float:right;margin-right:20px;cursor:pointer;" onclick="hideDWResult(\'results_'+id+'\');">[关闭]</span>员工列表</li>');
						for(var i=0;i<le;i++){	
						   if(i%2==0){
							contentHTML.push("<li style='background-color:#FFF;color:#3c3c64;text-indent:3px;line-height:2;cursor:pointer;width:230px;' onclick='"+config.handleFun+"(\""+id+"\","+ doJSONObjToStr(jsonArr[i])+")'>");			
							}
							else{
								contentHTML.push("<li style='background-color:#F0F1F7;color:#3c3c64;text-indent:3px;line-height:2;cursor:pointer;width:230px;' onclick='"+config.handleFun+"(\""+id+"\","+ doJSONObjToStr(jsonArr[i])+")'>");			
							}
							contentHTML.push("<span style='text-align:left;float:left;width:140px;'>"+jsonArr[i].deptName+"</span><strong style='text-align:left;float:left'>"+jsonArr[i].workerName+"</strong></li>");
						 }
					}
					else{						
						contentHTML.push('<li style="background-color:#FFF;text-indent:3px;line-height:2;color:#3c3c64;text-align:center;width:230px;"><无匹配数据></li>');
								
					}
					contentHTML.push('</ul>');
					contentHTML.push('<iframe frameborder="0" style="position:absolute;top:0px;left:0px; width:200px; height:'+h+'px; z-index:-1; background:#FFFFFF;filter=\'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)\'" scrolling="no"></iframe>');
					$("#results_"+id).html(contentHTML.join(''));
					contentHTML="";
					if(le<10){
						$("#results_"+id).css("height","auto");
						$("#results_"+id).css("overflow-y","hidden");
					}else{
						$("#results_"+id).css("height","266px");
						$("#results_"+id).css("overflow-y","auto");			
					}
				  //显示结果域
				  showDWResult("results_"+id);
			 }
	  });	
}

/**
 * Ajax查询员工
 * @param config
 */
function ajaxGetWorkerShang(config){
 var workerSearchStr=$("#"+config.workerStr).val();//输入的员工信息	
 if((typeof(workerSearchStr)=='undefined' || $.trim(workerSearchStr).length<=0)){
	$("#"+config.workerHiddenId).val('');
	hideDWResult('results_'+config.workerStr);
	return;
 }
 //如果没有显示域则创建 主要解决是选择部门后还没创建员工的显示域
 if($("#results_"+config.workerStr).length<=0){
	    var rLeft=0;
		if('undefined' == typeof(config.rleft) ){
			rLeft=$("#"+config.workerStr).offset().left;//设置层的left为指定组件的left距离 
		}else{
			rLeft =config.rleft;
			
		}
		$("#"+config.workerStr).after('<div id="results_'+config.workerStr+'" style="border:1px solid #000000; overflow-x:hidden;width:270px;height:auto;background:#FCFCFC;position:absolute;left:'+rLeft+'px;margin-top:0;*margin-top:22px;z-index:9999;font-size:12px;display:none;"></div>'); 
  }
 //ajax
  $.ajax({
	      type:'POST',
		  dataType:'json',
		  url:_rootPath+'/v/deptworker/ajaxgetworkershang',
		  data:{workerStr:$.trim(workerSearchStr)},
		  success:function(msg){
				var data=msg;	
				var contentHTML=[];
				var le=0;
				
				if(data.infoNo==1){			
					var jsonArr=eval(data.workerArr) || [];
					le=jsonArr.length;
					var h=(le+1)*24;
					contentHTML.push('<ul style="font-family:\'宋体\',Arial;margin:0;padding:0;text-indent:0;width:100%;height:'+h+'px">');
					contentHTML.push('<li style="background-color:#AFD9E6;text-indent:3px;line-height:2;color:#3c3c64;width:270px;text-align:left;float:left">');
					contentHTML.push('<span style="float:right;margin-right:20px;cursor:pointer;" onclick="hideDWResult(\'results_'+config.workerStr+'\');">[关闭]</span>员工列表</li>');
					for(var i=0;i<le;i++){	
					   if(i%2==0){
						contentHTML.push("<li style='background-color:#FFF;color:#3c3c64;text-indent:3px;line-height:2;cursor:pointer;width:270px;' onclick='"+config.handleFun+"("+ doJSONObjToStr(jsonArr[i])+")'>");			
						}
						else{
							contentHTML.push("<li style='background-color:#F0F1F7;color:#3c3c64;text-indent:3px;line-height:2;cursor:pointer;width:270px;' onclick='"+config.handleFun+"("+ doJSONObjToStr(jsonArr[i])+")'>");			
						}
						contentHTML.push("<span style='text-align:left;float:left;width:140px;'>"+jsonArr[i].deptName+"</span><strong style='text-align:left;float:left;width:90px;overflow:hidden;white-space:nowrap;'>"+jsonArr[i].workerName+"</strong></li>");
					 }
				}
				else{						
					contentHTML.push('<li style="background-color:#FFF;text-indent:3px;line-height:2;color:#3c3c64;text-align:center;width:230px;"><无匹配数据></li>');
				}
				contentHTML.push('</ul>');
				contentHTML.push('<iframe frameborder="0" style="position:absolute;top:0px;left:0px; width:200px; height:'+h+'px; z-index:-1; background:#FFFFFF;filter=\'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)\'" scrolling="no"></iframe>');
				$("#results_"+config.workerStr).html(contentHTML.join(''));
				contentHTML="";
				if(le<10){
					$("#results_"+config.workerStr).css("height","auto");
					$("#results_"+config.workerStr).css("overflow-y","hidden");
				}else{
					$("#results_"+config.workerStr).css("height","200px");
					$("#results_"+config.workerStr).css("overflow-y","auto");			
				}
			  //显示结果域
			  showDWResult("results_"+config.workerStr);
		 }
  });	
}

/**
 * Ajax查询职务--ymPrompt
 * @param config
 */
function ajaxGetDutyYm(config){	
	 var dutySearchStr=$("#ym-window").find("#"+config.dutyStr).val();
	 if(typeof(dutySearchStr)=='undefined' || $.trim(dutySearchStr).length<=0){
		$("#ym-window").find("#"+config.dutyHiddenId).val('');
		 hideDWResult('results_'+config.dutyStr);
		 return;
	 }

	  var rLeft=0;
	  if('undefined' == typeof(config.rleft) ){
		 rLeft=$("#ym-window").find("#"+config.dutyStr).offset().left;//设置层的left为指定组件的left距离
	  }else{
		 rLeft =config.rleft;
	  }
	  //如果没有显示域则创建 主要解决是选择部门后还没创建员工的显示域
	 if($("#ym-window").find("#results_"+config.dutyStr).length<=0){
			$("#ym-window").find("#"+config.dutyStr).after('<div id="results_'+config.dutyStr+'" style="border:1px solid #000000; overflow-x:hidden;width:230px;height:auto;background:#FCFCFC;position:absolute;left:'+rLeft+'px;margin-top:0;*margin-top:22px;z-index:9999;font-size:12px;display:none;"></div>'); 
	 }else{
	  if($("#ym-window").find("#results_"+config.dutyStr).css("left").replace("px","") != rLeft){
		  $("#ym-window").find("#results_"+config.dutyStr).css("left",rLeft);
	  }
	 }
	 //ajax
	  $.ajax({
		      type:'POST',
			  dataType:'json',
			  url:_rootPath+'/v/deptworker/ajaxDuty',
			  data:{dutyID:$.trim(dutySearchStr)},
			  success:function(msg){
					var data=msg;	
					var contentHTML=[];
					var le=0;
					if(data.infoNo==1){			
						var jsonArr=eval(data.postList) || [];
						le=jsonArr.length;
						var h=(le+1)*24;
						contentHTML.push('<ul style="font-family:\'宋体\',Arial;margin:0;padding:0;text-indent:0;width:100%;height:'+h+'px">');
						contentHTML.push('<li style="background-color:#AFD9E6;text-indent:3px;line-height:2;color:#3c3c64;width:230px;text-align:left;float:left">');
						contentHTML.push('<span style="float:right;margin-right:20px;cursor:pointer;" onclick="hideDWResult(\'results_'+config.dutyStr+'\');">[关闭]</span>职务列表</li>');	
						for(var i=0;i<le;i++){	
						   if(i%2==0){
							contentHTML.push("<li style='background-color:#FFF;color:#3c3c64;text-indent:3px;line-height:2;cursor:pointer;width:230px;' onclick='"+config.handleFun+"("+ doJSONObjToStr(jsonArr[i])+")'>");			
							}
							else{
								contentHTML.push("<li style='background-color:#F0F1F7;color:#3c3c64;text-indent:3px;line-height:2;cursor:pointer;width:230px;' onclick='"+config.handleFun+"("+ doJSONObjToStr(jsonArr[i])+")'>");			
							}
							contentHTML.push(jsonArr[i].name+"</li>");
						 }
					}
					else{						
						contentHTML.push('<li style="width:100%;background-color:#FFF;text-indent:3px;line-height:2;color:#3c3c64;text-align:center;"><无匹配数据></li>');
								
					}
					contentHTML.push('</ul>');
					contentHTML.push('<iframe frameborder="0" style="position:absolute;top:0px;left:0px; width:18px; height:'+h+'px; z-index:-1; background:#DFFEBA;filter=\'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)\'" scrolling="no"  ></iframe>');
					$("#results_"+config.dutyStr).html(contentHTML.join(''));
					contentHTML="";
					if(le<10){
						$("#results_"+config.dutyStr).css("height","auto");
						$("#results_"+config.dutyStr).css("overflow-y","hidden");
					}else{
						$("#results_"+config.dutyStr).css("height","266px");
						$("#results_"+config.dutyStr).css("overflow-y","auto");			
					}
				 //显示
				 showDWResult("results_"+config.dutyStr);				
			 }
	  });	
}

/**
 * Ajax查询员工--ymPrompt
 * @param config
 */
function ajaxGetWorkerShangYm(config){
  var workerSearchStr=$("#ym-window").find("#"+config.workerStr).val();//输入的员工信息	
  if((typeof(workerSearchStr)=='undefined' || $.trim(workerSearchStr).length<=0)){
	 $("#"+config.workerHiddenId).val('');
	 hideDWResult('results_'+config.workerStr);
	 return;
  }
  //如果没有显示域则创建 主要解决是选择部门后还没创建员工的显示域
  var rLeft=0;
  if('undefined' == typeof(config.rleft) ){
 	 rLeft=$("#ym-window").find("#"+config.workerStr).offset().left;//设置层的left为指定组件的left距离
  }else{
     rLeft =config.rleft;
  }
  if($("#ym-window").find("#results_"+config.workerStr).length<=0){
		$("#ym-window").find("#"+config.workerStr).after('<div id="results_'+config.workerStr+'" style="border:1px solid #000000; overflow-x:hidden;width:240px;height:auto;background:#FCFCFC;position:absolute;left:'+rLeft+'px;margin-top:0;*margin-top:24px;z-index:9999;font-size:12px;display:none;"></div>'); 
  }else{
	  if($("#ym-window").find("#results_"+config.workerStr).css("left").replace("px","") != rLeft){
		  $("#ym-window").find("#results_"+config.workerStr).css("left",rLeft);
	  }
  }
	var myUrl="/v/deptworker/ajaxgetworkershang";
	if('undefined' == typeof(config.myUrl) ){
		myUrl="/v/deptworker/ajaxgetworkershang";
	}else{
		myUrl=config.myUrl;
	}
  //
 //ajax
  $.ajax({
	      type:'POST',
		  dataType:'json',
		  url:_rootPath+myUrl,
		  data:{workerStr:$.trim(workerSearchStr)},
		  success:function(msg){
				var data=msg;	
				var contentHTML=[];
				var le=0;
				
				if(data.infoNo==1){			
					var jsonArr=eval(data.workerArr) || [];
					le=jsonArr.length;
					var h=(le+1)*24;
					contentHTML.push('<ul style="font-family:\'宋体\',Arial;margin:0;padding:0;text-indent:0;width:240;height:'+h+'px">');
					contentHTML.push('<li style="background:#AFD9E6;text-indent:3px;line-height:24px;height:24px;color:#3c3c64;width:230px;text-align:left;float:left">');
					contentHTML.push('<span style="background:#AFD9E6;float:right;margin-right:20px;cursor:pointer;" onclick="hideDWResult(\'results_'+config.workerStr+'\');">[关闭]</span>员工列表</li>');
					for(var i=0;i<le;i++){	
						if(i%2==0){
							contentHTML.push("<li style='background:#FFF;color:#3c3c64;text-indent:3px;line-height:22px;height:22px;cursor:pointer;width:230px;' onclick='"+config.handleFun+"("+ doJSONObjToStr(jsonArr[i])+")'>");
							contentHTML.push("<span style='text-align:left;float:left;width:140px;'>"+jsonArr[i].deptName+"</span><strong style='text-align:left;float:left;width:90px;overflow:hidden;white-space:nowrap;'>"+jsonArr[i].workerName+"</strong></li>");
						}else{
							contentHTML.push("<li style='color:#3c3c64;text-indent:3px;line-height:22px;height:22px;cursor:pointer;width:230px;' onclick='"+config.handleFun+"("+ doJSONObjToStr(jsonArr[i])+")'>");			
							contentHTML.push("<span style='text-align:left;float:left;width:140px;background:#F0F1F7;'>"+jsonArr[i].deptName+"</span><strong style='text-align:left;float:left;width:90px;overflow:hidden;white-space:nowrap;background:#F0F1F7;'>"+jsonArr[i].workerName+"</strong></li>");
						}
					 }
				}
				else{						
					contentHTML.push('<li style="background-color:#FFF;text-indent:3px;line-height:2;color:#3c3c64;text-align:center;width:230px;"><无匹配数据></li>');
				}
				contentHTML.push('</ul>');
				contentHTML.push('<iframe frameborder="0" style="position:absolute;top:0px;left:0px; width:230px; height:'+h+'px; z-index:-1; background:#FFFFFF;filter=\'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)\'" scrolling="no"></iframe>');
				$("#results_"+config.workerStr).html(contentHTML.join(''));
				contentHTML="";
				if(le<10){
					$("#results_"+config.workerStr).css("height","auto");
					$("#results_"+config.workerStr).css("overflow-y","hidden");
				}else{
					$("#results_"+config.workerStr).css("height","200px");
					$("#results_"+config.workerStr).css("overflow-y","auto");			
				}
			  //显示结果域
			  showDWResult("results_"+config.workerStr);
		 }
  });	
}



function ajaxGetManager(config){
	 var workerSearchStr=$("#"+config.workerStr).val();//输入的员工信息	
	 if((typeof(workerSearchStr)=='undefined' || $.trim(workerSearchStr).length<=0)){
		$("#"+config.workerHiddenId).val('');
		hideDWResult('results_'+config.workerStr);
		return;
	 }
	 //如果没有显示域则创建 主要解决是选择部门后还没创建员工的显示域
	 if($("#results_"+config.workerStr).length<=0){
		    var rLeft=$("#"+config.workerStr).offset().left;//设置层的left为指定组件的left距离
			$("#"+config.workerStr).after('<div id="results_'+config.workerStr+'" style="border:1px solid #000000; overflow-x:hidden;width:230px;height:auto;background:#FCFCFC;position:absolute;left:'+rLeft+'px;margin-top:0;*margin-top:22px;z-index:9999;font-size:12px;display:none;"></div>'); 
	  }
	 //ajax
	  $.ajax({
		      type:'POST',
			  dataType:'json',
			  url:_rootPath+'/v/deptworker/ajaxgetdeptmanage',
			  data:{workerStr:$.trim(workerSearchStr)},
			  success:function(msg){
					var data=msg;	
					var contentHTML=[];
					contentHTML.push('<ul style="font-family:\'宋体\',Arial;margin:0;padding:0;text-indent:0;width:100%;">');
					contentHTML.push('<li style="background-color:#FFD700;text-indent:3px;line-height:2;color:#3c3c64;width:230px;">');
					contentHTML.push('<span style="float:right;margin-right:20px;cursor:pointer;" onclick="hideDWResult(\'results_'+config.workerStr+'\');">[关闭]</span>员工列表</li>');
					var le=0;
					if(data.infoNo==1){			
						var jsonArr=eval(data.workerArr) || [];
						le=jsonArr.length;
						for(var i=0;i<le;i++){	
						   if(i%2==0){
							contentHTML.push("<li style='background-color:#FFF;color:#3c3c64;text-indent:3px;line-height:2;cursor:pointer;width:230px;' onclick='"+config.handleFun+"("+ doJSONObjToStr(jsonArr[i])+")'>");			
							}
							else{
								contentHTML.push("<li style='background-color:#F0F1F7;color:#3c3c64;text-indent:3px;line-height:2;cursor:pointer;width:230px;' onclick='"+config.handleFun+"("+ doJSONObjToStr(jsonArr[i])+")'>");			
							}
							contentHTML.push(jsonArr[i].deptName+"&nbsp;&nbsp;<strong>"+jsonArr[i].workerName+"</strong></li>");
						 }
					}
					else{						
						contentHTML.push('<li style="background-color:#FFF;text-indent:3px;line-height:2;color:#3c3c64;text-align:center;width:230px;"><无匹配数据></li>');
								
					}
					contentHTML.push('</ul>');
					contentHTML.push('<iframe frameborder="0" style="position:absolute;top:0px;left:0px; width:200px; height:1000px; z-index:-1; background:#DFFEBA;filter=\'progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)\'" scrolling="no"></iframe>');
					$("#results_"+config.workerStr).html(contentHTML.join(''));
					contentHTML="";
					if(le<10){
						$("#results_"+config.workerStr).css("height","auto");
						$("#results_"+config.workerStr).css("overflow-y","hidden");
					}else{
						$("#results_"+config.workerStr).css("height","266px");
						$("#results_"+config.workerStr).css("overflow-y","auto");			
					}
				  //显示结果域
				  showDWResult("results_"+config.workerStr);
			 }
	  });	
}




/****************************************可独立ajax查询 部门、员工 显示为下来列表   结束*****************************************/
/****************************************公共函数 开始***********************************************************************/
/**
	功能说明:显示结果域
*/
function showDWResult(resultDiv){

	if($("#"+resultDiv).length>0){
		$("#"+resultDiv).show();
		$("#ym-window").find("#"+resultDiv).show();
	}
}
/**
  功能说明:隐藏结果域
*/
function hideDWResult(resultDiv){
	if($("#"+resultDiv).length>0){
		$("#"+resultDiv).hide();
		$("#ym-window").find("#"+resultDiv).hide();
	}
}

/**
	功能说明:JSON对象转换为json格式字符串
*/
function doJSONObjToStr(jsonObj){
	var str=[];
	for (var n in jsonObj){
	  str.push(n+":\""+jsonObj[n]+"\"");
	}
	return "{"+str.join(',')+"}";
}
/****************************************公共函数 结束**********************************************************************/